<?php
//------- INITIALIZATION
/* Files */
/*This is where include and include_once functions are placed in.
files needed and used throughout the website are included here.
Function-specific include statements are placed and called whenever
they are needed or used.*/

//------CONSTANTS-------------------------------------------------
	//*DATABASE DEFINITIONS*/
//-----------------------------------------------------------------
	session_start();
	include_once('server/config.php');
	include_once('server/htmlPreProc.php');
	include_once('server/cmdVarControl.php');
	include_once('server/flashMgr.php');
	include_once('server/emailer.php');
	include_once('server/sqlControl.php');
	include_once('server/sqlControlPlus.php');
	include_once('server/specialFields.php');
	include_once('server/fileUpload.php');
	if (CM_LOGINTABLE != 'none')
	{
		include_once('server/userControl.php');
		include_once('3rdPartyPHP/loginTickets.php');
		include_once('server/adminControl.php');
		include_once('server/cms.php');
	}
	else
	{
		//doNothing();
	}
	flash('enabled');
/* Variables */
/*This is where variables are initialized and declared. Use the camel-
case convetion in naming variables. Only global variables are to be
declared and initialized here*/
	
	/*NAVIGATION -- Logged Out*/
	$navigationArray1 = array();
	$navigationArray1[0] = 'home|Home';
	$navigationArray1[1] = 'content|content';
	$navigationArray1[2] = 'blog|blog';
	$navigationArray1[3] = 'gallery|gallery';
	/*CSS*/
	$cssArray = array();
	//$cssArray[0] = 'css/global.css';
	//$cssArray[1] = 'css/slimbox.css';
	/*TITLE*/
	$title = 'Content Editor';
	
	/*HEADER CONTENT*/
	$headerContents = '
	';
	
	
	/*FOOTER CONTENT*/
	$footerContents = '
		<div id="footer">
		Content Management System &copy; 2010 <a href="http://www.clickmediaph.com/main.php">Click Media Philippines</a>. All Rights Reserved.
		</div>
	</body>
	</html>';
	
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//------- ACTIONS
/*This is where things are made to happen. This is where functions are
called and where data and actions are being circulated globally.*/
	if (CM_LOGINTABLE != 'none')
	{
		if (get('log') == 'create')
		{
			createNewAccount(post('fname'), post('lname'), post('userName'), post('password'));
		}
		else if (get('log') == 'in')
		{
			adminlog('in');
		}
		else if (get('log') == 'out')
		{
			adminlog('out');
		}
		
		secureLogIn();
	}
	
	
	echo widgetHeader($title, $cssArray, $navigationArray1, $headerContents);
	//echo adminContent('<a href="main.php?page=home&log=out">LogOut</a>');
	//echo '<div id="pageContent">';
	if (secureLogIn() == '1')
	{
		echo loadExtPage('widgets/pages', $navigationArray1);
	}
	else
	{
		echo 'You have been signed in through another computer. Close this window and log in again.';
	}
	//echo '</div>';
	echo footer($footerContents);
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
?>